//
//  MCCreateHeaderView.swift
//  MCBodyBuildingPro
//
//  Created by Renlvshijie on 2023/5/19.
//

import UIKit
import JKSwiftExtension
import SnapKit
import SJUIKit
import QMUIKit


typealias timeOrWeightBlock = (_ times:Int) -> Void

class MCCreateHeaderView: UIView {
    
    var ower:MCCreateNewPlanVc!
    
    
    @IBOutlet weak var titleTF: QMUITextField!
    @IBOutlet weak var numTitleLabel: UILabel!
    

    @IBOutlet weak var planURLBtn: UIButton!
    
    @IBOutlet weak var jieshaoTextView: QMUITextView!
    @IBOutlet weak var numTextViewLabel: UILabel!
    
    
    @IBOutlet weak var timeInfoBtn: UIButton!
    
    @IBOutlet weak var numOfTimesSenderBtn: UIButton!
    
    //音乐
    @IBOutlet weak var musicPlayerView: UIView!
    @IBOutlet weak var musicLabel: UILabel!
    
    //声明数据
    var timesBlock:timeOrWeightBlock?
    
    @IBOutlet weak var addZuInfoLabel: UILabel!
    
    
    static func initHeaderView() -> MCCreateHeaderView {
        return Bundle.main.loadNibNamed("MCCreateHeaderView", owner: self)?.first as! MCCreateHeaderView
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
      
    }
    
    
    required init?(coder: NSCoder) {
        super.init(coder: coder)
    
    }
    

    //警告内容
    @IBAction func alertSender(_ sender: UIButton) {
        
        
    }
    
    //时间选择
    @IBAction func timeSelectSender(_ sender: UIButton) {
        
        if sender.isSelected == false {
            sender.isSelected = true
            sender.setImage(UIImage(named: "common_select_in_gray_image"), for: .selected)
            self.numOfTimesSenderBtn.setImage(UIImage(named: "common_unselect_light_gray_image"), for: .normal)
            self.numOfTimesSenderBtn.isSelected = false
            self.timesBlock!(0)
        }
        
        
    }
    
    
    //次数选择
    @IBAction func numberTimesSender(_ sender: UIButton) {
        
        if sender.isSelected == false {
            self.timeInfoBtn.isSelected = false
            self.numOfTimesSenderBtn.isSelected = true
            self.timeInfoBtn.setImage(UIImage(named: "common_unselect_light_gray_image"), for: .normal)
            sender.setImage(UIImage(named: "common_select_in_gray_image"), for: .selected)
            self.timesBlock!(1)
        }
       
    }
    
    
    

}
